package com.example.demo.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.example.demo.pojo.CarGood;
import com.example.demo.pojo.Order;
@Transactional
@Repository
public interface OrderDao extends JpaRepository<Order, Long> {
	public List<Order> findByUserId(String id);
	public List<Order> findByGoodId(String goodsId);
	
	@Query(value = "delete from user_order where id= ?1", nativeQuery = true)
	@Modifying
	void deleteById(String id);
	
	@Query(value = "update user_order set state='0' where id= ?1", nativeQuery = true)
	@Modifying
	void updateStateById(String id);
}
